package com.example.thread;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

/**
 * Created by weng.junjie on 2017/2/23.
 */
public class ThreadTest {
    private static volatile boolean needStop;

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread() {
            public void run() {
                while (!needStop){
                    //System.out.println(".....");
                }
                System.out.println("stop");
            }
        };
        t.start();
        TimeUnit.SECONDS.sleep(2);
        needStop = true;

        ConcurrentHashMap<String,String> str;
    }
}
